const state = {
  sumPrice: 0,
  sum: 0,
  shoppingCart :[
    { name: 'shoe', price: 12, num: 0 },
    { name: 'shirt', price: 22, num: 0 },
    { name: 'pant', price: 37, num: 0 },
  ]
}
const mutations = {
 // ... existing code ...
Addnum(state, index) {
    state.shoppingCart[index].num++;
    state.sum++;
    state.sumPrice += state.shoppingCart[index].price;
},
Subnum(state, index) {
    if (state.shoppingCart[index].num >= 1) {
        state.shoppingCart[index].num--;
        state.sum--;
        state.sumPrice -= state.shoppingCart[index].price;
    }
},

}
const actions = {
  
}
const getters = {
  
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}